<include file="Public/head"/>
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<script src="http://img1.isou365.cn/paimai/yunying/js/city.js" type="text/javascript"></script>
<style>
    .xuanzhe ul li .menDao1{width:300px;}
    .xuanzhe ul li .menDao1 a{display:block;background:#cecece;color:#303030;float:left;width:36px; text-align:center;height:20px; line-height:20px; cursor:pointer;}
    .xuanzhe ul li .menDao1 .menHover{ background:#20ab4f;color:#fff;}
</style>
<include file="Public/common_header"/>
<div class="mian">
    <include file="Public/sidebar" menu="shgl.fj"/>
    <div class="mianR">
        <div class="listBox">
            <h3 class="cha">复检详情</h3>
            <div class="car_info">
                    <div class="car_no"><span style="font-size:14px;">拍卖单号：<b>{$detail.order_no}</b></span></div>
                  <if condition="$detail.channel neq 5">
                    <table border="1" width="100%">
                        <tbody>
                        <tr>
                            <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>车主信息</span></td>
                        </tr>
                        <tr>
                            <td width="11%" style="color:#898b8a;">车主类型</td>
                            <td width="39%">{$detail.owner_type_name}</td>
                            <if condition="$detail.owner_type eq 1">
                                <td width="11%" style="color:#898b8a;">车主姓名</td>
                                <td width="39%">{$detail.seller_name}</td>
                                <else />
                                <td width="11%" style="color:#898b8a;">公司名称</td>
                                <td width="39%">{$detail.seller_name}</td>
                            </if>
                        </tr>
                        <tr>
                            <if condition="$detail.owner_type eq 1">
                                <td width="11%" style="color:#898b8a;">联系电话</td>
                                <td colspan="3">{$detail.seller_phone}</td>
                                <else />
                                <td width="11%" style="color:#898b8a;">联系人姓名</td>
                                <td width="39%">{$detail.contact_person}</td>
                                <td width="11%" style="color:#898b8a;">联系电话</td>
                                <td width="39%">{$detail.seller_phone}</td>
                            </if>
                        </tr>
                        </tbody>
                    </table>
                  <else/>
                    <table border="1" width="100%">
                        <tbody>
                            <tr>
                                <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>评估师信息</span></td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">评估师姓名</td>
                                <td width="39%">{$detail.checker_name}</td>
                                <td width="11%" style="color:#898b8a;">评估师电话</td>
                                <td width="39%">{$detail.checker_phone}</td>
                            </tr>
                        </tbody>
                    </table>
                  </if>
                <table border="1" width="100%" style="margin-top:10px;">
                        <tbody>
                            <tr>
                                <td colspan="4" style="background-color:#c1c1c1;font-size:14px;">
                                    <span>车辆信息</span>
                                    <span style="float: right;margin-right: 20px;"><a style="color: #0000FF;text-decoration: underline;" href="/Car/report/car_id/{$detail.car_id}" target="_blank">检测报告</a></span>
                                </td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">车型</td>
                                <td width="39%">{$detail.model}</td>
                                <td width="11%" style="color:#898b8a;">排放标准</td>
                                <td width="39%">{$detail.emission}</td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">初登日期</td>
                                <td>{$detail.first_reg_date}</td>
                                <td style="color:#898b8a;">颜色</td>
                                <td>{$detail.car_color}</td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">表显里程</td>
                                <td>{$detail.pointer_mileage}万公里</td>
                                <td style="color:#898b8a;">车况级别</td>
                                <td>{$detail.composite_state}{$detail.accident_level}</td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">车辆注册地</td>
                                <td>{$detail.first_reg_city}</td>
                                <td style="color:#898b8a;">车架号</td>
                                <td>{$detail.vin}</td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">车牌号</td>
                                <td>{$detail.plate_prefix}{$detail.plate_suffix}</td>
                                <td style="color:#898b8a;">过户限制</td>
                                <td>{$detail.transfer_limit}</td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">渠道来源</td>
                                <td>
                                    <if condition="$detail.comefrom neq ''">
                                        <?php if(empty($detail['comefrom_url'])):?>
                                        {$detail.comefrom}
                                        <?php else: ?>
                                        <a href="{$detail.comefrom_url}" target="_blank" rel="noreferrer">{$detail.comefrom}</a>
                                        <?php endif;?>
                                        <else/>
                                        未知
                                    </if>
                                </td>
                                <td style="color:#898b8a;">所在地</td>
                                <td>{$detail.location_area}</td>
                            </tr>
                        </tbody>
                    </table>
                  <if condition="$detail.car_source eq 1">
                    <table border="1" width="100%" style="margin-top:10px;">
                        <tbody>
                            <tr>
                                <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>回车信息</span></td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">加油要求</td>
                                <td width="39%">{$return_detail.refuel_demand}元</td>
                                <td width="11%" style="color:#898b8a;">代驾公司</td>
                                <td width="39%">{$return_detail.driver_company}</td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">代驾姓名</td>
                                <td>{$return_detail.driver_name}</td>
                                <td style="color:#898b8a;">代驾电话</td>
                                <td>{$return_detail.driver_phone}</td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">代驾出发时间</td>
                                <td>{$return_detail.depart_time}</td>
                                <td style="color:#898b8a;">开票要求</td>
                                <td>{$return_detail.invoice}元</td>
                            </tr>
                            <tr width="100%">
                                <td style="color:#898b8a;">车钥匙</td>
                                <td>{$return_detail.carkey}把</td>
                                <td style="color:#898b8a;">交付门店</td>
                                <td>{$return_detail.delive_store_str}</td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">回车手续</td>
                                <td colspan="4">{$return_detail.procedure}</td>
                            </tr>
                            <?php if(!empty($return_detail['procedures_upload'])):?>
                                <tr>
                                    <td style="color:#898b8a;">手续上传要求</td>
                                    <td colspan="4">{$return_detail.procedures_upload}</td>
                                </tr>
                            <?php endif;?>
                            <tr>
                                <td style="color:#898b8a;">车辆补充说明</td>
                                <td colspan="4">{$return_detail.desc}</td>
                            </tr>
                        </tbody>
                    </table>
                  </if>

                    <if condition="$detail.return_check_status gt 4">
                        <table border="1" width="100%" style="margin-top:10px;">
                            <tbody>
                            <tr>
                                <td colspan="4" style="background-color:#c1c1c1;font-size:14px;">
                                    <span>复检信息</span>
                                </td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">手续复检人</td>
                                <td width="39%">{$detail.procedure_checker}</td>
                                <td width="11%" style="color:#898b8a;">车况复检人</td>
                                <td width="39%">{$detail.condition_checker}</td>
                            </tr>
                            <tr>
                                <td width="11%" style="color:#898b8a;">复检时间</td>
                                <td width="39%">{$detail.recheck_time}</td>
                                <td width="11%" style="color:#898b8a;">核实手续</td>
                                <td width="39%">{$detail.recheck_procedures}</td>
                            </tr>
                            <tr>
                                <td style="color:#898b8a;">车况描述</td>
                                <td colspan="4">{$detail.recheck_remark}</td>
                            </tr>
                            </tbody>
                        </table>
                    </if>

                <table border="1" width="100%" style="margin-top:10px;">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;">
                            <span>成交确认信息</span>
                        </td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">成交客服</td>
                        <td width="39%">{$detail.owner_confirm_name}</td>
                        <td width="11%" style="color:#898b8a;">成交客服电话</td>
                        <td width="39%">{$detail.owner_confirm_mobile}</td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">成交确认时间</td>
                        <td width="39%">{$detail.owner_confirm_time}</td>
                        <td width="11%" style="color:#898b8a;">成交价格</td>
                        <td width="39%">{$detail.success_price} 元</td>
                    </tr>
                    <tr>
                        <td width="5%" style="color:#898b8a;">成交确认备注</td>
                        <td width="39%" colspan="3"  >{$detail.owner_confirm_remark}</td>
                    </tr>
                    </tbody>
                </table>
                </div>
        </div>

        <if condition="$detail.car_source eq 1">
            <h3 class="cha">手续上传要求</h3>
            <div class="transfer-want">
                <div class="transfer-front clearfix">
                    <dl class="clearfix" style="height: 310px;">
                        <dt style="height: 310px;">
                            <span style="margin-top: 134px;">过户前</span>
                        </dt>
                        <empty name="beforeTransfer">
                            <dd class="not-upload">无上传要求</dd>
                        </empty>
                        <dd>
                            <ul >
                                <?php foreach($beforeTransfer as $pb):?>
                                <li data-id="1" class="clearfix">
                                    <span>{$pb.certificate_name}</span>
                                    <input type="button" class="<?php echo ($pb['certificate_image_type']==1 || $pb['certificate_image_type']==3) ? 'current' : '' ;?>" data-id="1" value="照片" >
                                    <input type="button" class="<?php echo ($pb['certificate_image_type']==2 || $pb['certificate_image_type']==3) ? 'current' : '' ;?>" data-id="2" value="扫描件">
                                </li>
                                <?php endforeach;?>
                            </ul>
                        </dd>
                    </dl>
                    <dl class="clearfix" style="margin-left:24px;">
                        <dt style="height: 310px;"><span style="margin-top: 134px;">过户后</span></dt>
                        <empty name="afterTransfer">
                            <dd class="not-upload">无上传要求</dd>
                        </empty>
                        <dd>
                            <ul>
                                <?php foreach($afterTransfer as $pa):?>
                                <li data-id="2" class="clearfix">
                                    <span>{$pa.certificate_name}</span>
                                    <input type="button" class="<?php echo ($pa['certificate_image_type']==1 || $pa['certificate_image_type']==3) ? 'current' : '' ;?>" data-id="1" value="照片" >
                                    <input type="button" class="<?php echo ($pa['certificate_image_type']==2 || $pa['certificate_image_type']==3) ? 'current' : '' ;?>" data-id="2" value="扫描件">
                                </li>
                                <?php endforeach;?>
                            </ul>
                        </dd>
                    </dl>
                </div>
            </div>
        </if>

        <?php if(!empty($logs)):?>
            <h3 class="yonghu">系统跟踪日志</h3>
            <div class="yonghuText">
                <ul>
                    <volist name="logs" id="log" key="k">
                        <li class="{$k%2==0?'xitongBg':''} clearfix">
                            <em class="huShi">{$log.create_time}</em>
                            <em>复检员</em>
                            <em>{$log.rechecker}</em>
                            <em>{$log.action}</em>
                            <em class="huShi">{$log.remark}</em>
                        </li>
                    </volist>
                </ul>
            </div>
        <?php endif;?>
      <if condition="$detail.return_check_status lt 5">
        <h3 class="yonghu">请选择核实结果</h3>
        <div class="listBox">
            <div class="yuList">
                <div class="shop_details">
                    <ul>
                        <li>
                            <span>车况复检人员</span>
                            <em>
                                <select id="rechecker" class="" <?php echo $recheck_info['status']==1 ? "disabled" : "" ;?> >
                                    <option value="0">请选择复检人员</option>
                                    <?php foreach($recheck_staff_list as $v):?>
                                        <option value="{$v.emp_id}">{$v.real_name}</option>
                                    <?php endforeach?>
                                </select>
                            </em>
                            <script>$("#rechecker").val("<?php echo $recheck_info['condition_checker']?>")</script>
                        </li>
                        <li>
                            <span>复检时间</span>
                            <em><input id="recheck_time" type="text" name="recheck_time" value="<?php echo $recheck_info['status']==1 ? $recheck_info['recheck_time'] : '';?>" <?php echo $recheck_info['status']==1 ? "disabled" : "" ;?> placeholder="请选择复检时间" readonly="" class="driving_time"></em>
                        </li>
                        <li><span>核实车况</span>
                            <div class="verify <?php echo $recheck_info['status']==1 ? 'not-point' : '' ;?>">
                                <ul class="clearfix">
                                    <li data-id="1" class="<?php echo $recheck_info['is_car_condition_conform']==1 ? 'current' : '' ;?>">车况相符</li>
                                    <li data-id="2" class="<?php echo $recheck_info['is_car_condition_conform']==2 ? 'current' : '' ;?>">车况不符</li>
                                </ul>
                            </div>
                            <div class="verify-cont" style="display: none;">
                                <span>车况描述</span>
                                <textarea id="condition_desc" class="remarks_text"><?php echo $recheck_info['status']==1 ? $recheck_info['remark'] : '' ;?></textarea>
                            </div>
                        </li>
                        <li>
                            <?php if($detail['car_source']==1):?>
                            <span>核实手续</span>
                            <ul class="verify_procedure procedures">
                                <?php foreach($procedures as $procedure):?>
                                <li class="<?php echo mb_strpos($recheck_info['procedures'],$procedure)!==false ? 'current' : '' ;?>">{$procedure}</li>
                                <?php endforeach;?>
                            </ul>
                            <?php else:?>
                            <span>复检手续</span>
                            <ul class="procedures">
                                <?php foreach($procedures as $procedure):?>
                                <li>{$procedure}</li>
                                <?php endforeach;?>
                            </ul>
                            <?php endif;?>
                        </li>
                    </ul>
                    <input type="hidden" id="vehicle-condition" value="{$recheck_info.is_car_condition_conform}">
                </div>
                <div class="yongBtn">
                    <input type="button" data-id="2" value="<?php echo $detail['car_source']==1 ? '继续跟踪' : '确定' ;?>" class="queding">
                    <input type="button"  class="quxiao" value="返回">
                </div>
            </div>
        </div>
      <else/>
        <div class="yongBtn1">
            <input type="button" onclick="window.close();" class="quxiao" value="关闭">
        </div>
      </if>
    </div>
    <div class="clear"></div>
</div>
<div class="review-alert">
    <ul>
        <li>
            <span>下次跟踪时间</span>
            <input id="next_trace_time" type="text" name="next_trace_time" value="" placeholder="请选择下次跟踪时间" readonly="" class="driving_time">
        </li>
        <li>
            <span>跟踪原因</span>
            <textarea id="trace_reason"></textarea>
        </li>
    </ul>
    <div class="shenhei-btn">
        <input type="button" value="确定" class="determine">
        <input type="button" value="取消" class="cancel">
    </div>
</div>
<script>
    $(document).ready(function(){
        <!-- 手续上传要求开始-->
        var oH=$(".transfer-front dl:last-of-type").outerHeight();
        $(".transfer-front dl:first-child").css("height",oH+"px");
        $(".transfer-front dl dt").css("height",oH+"px");
        var oSh=$(".transfer-front dl dt span").height();
        $(".transfer-front dl dt span").css("marginTop",(oH-oSh)/2+"px");
        <!-- 手续上传要求结束-->

        $(".driving_time").ymdateplugin({
            showTimePanel: true,
            changeMonth: true,
            changeYear: true
        });

        $("#rechecker,#rechecker2").select2();

        var car_source = "<?php echo $detail['car_source']; ?>"
        var postData = {"id":"<?php echo $recheck_info['rl_id'];?>"};

        $(".verify ul li").on("click",function(){
            $(".verify ul li").removeClass("current")
            $(this).addClass("current")
            $("#vehicle-condition").val($(this).attr("data-id"));
            if($(this).index()==1){
                $(".verify-cont").show();
            }else{
                $(".verify-cont").hide();
            }
        })

        $(".procedures li").on('click',function () {
            $(this).toggleClass("current");
        })

        $(".verify_procedure li").on("click",function(){
            if($(".verify_procedure .current").length==$(".verify_procedure li").length){
                $(".shop_details .checkmark").show();
                $(".yongBtn .queding").val("确定");
            }else{
                $(".shop_details .checkmark").hide();
                $(".yongBtn .queding").val("继续跟踪");
            }
        })

        $(".not-point ul li").unbind("click");

        $(".quxiao").click(function () {
           window.location.href=document.referrer;
        });

        $(".yongBtn .queding").on("click",function(){
            var recheck_man = $("#rechecker").val()
            if(recheck_man<1){
                shibai_alert2("请选择车况复检人员", 500)
                return
            }
            postData.recheck_man = recheck_man
            var recheck_time = $("#recheck_time").val()
            if(recheck_time==''){
                shibai_alert2("请选择复检时间", 500)
                return
            }
            postData.recheck_time = recheck_time
            var vehicle_condition = $("#vehicle-condition").val();
            if(vehicle_condition == 0){
                shibai_alert2("请选择车况", 500)
                return
            }
            postData.vehicle_condition = vehicle_condition
            if(vehicle_condition==2){
                var condition_desc = $.trim($("#condition_desc").val());
                if(condition_desc == ''){
                    shibai_alert2("请填写车况描述")
                    return
                }
                postData.condition_desc = condition_desc
            }

            var procedureObj = []
            $("ul.procedures li.current").each(function() {
                procedureObj.push($(this).text());
            });
            postData.procedures = procedureObj.join("、");

            if(car_source==1){
                $(".procedures li").each(function(){
                    if($(".procedures .current").length!=$(".procedures li").length){
                        $(".review-alert").fadeIn();
                        var oHeight=$(".review-alert").outerHeight();
                        $(".review-alert").css("marginTop",-oHeight/2+"px");
                        $(".yunBei").css("display","block");
                    }else{
                        confirm_alert("您确认复检完成了吗？");
                    }
                })
            }else {
                confirm_alert("您确认复检完成了吗？");
            }
        })



        $("body").on("click",".chenggong1 .determine",function(){
            postData.status = 2
            _submit(postData)
        })

        $(".shenhei-btn .determine").on("click",function(){
            var next_trace_time = $("#next_trace_time").val()
            if(next_trace_time == ''){
                shibai_alert1("请选择下次跟踪时间")
                return
            }
            postData.next_trace_time = next_trace_time
            var trace_reason = $("#trace_reason").val()
            if(trace_reason==''){
                shibai_alert1("请输入跟踪原因")
                return
            }
            postData.trace_reason = trace_reason
            postData.status = 1
            _submit(postData)
        })

        $(".shenhei-btn .cancel").on("click",function(){
            $(".review-alert #recheck_time1").val("");
            $(".review-alert textarea").val("");
            $(".review-alert").fadeOut();
            $(".yunBei").css("display","none");
        })

        function _submit(postData) {
            $(".yunBei").css("display","block").unbind('click')
            $(".loading").fadeIn();
            $.post("/Recheck/saveRecheck",postData,function (data) {
                if(data.code !== 200){
                    shibai_alert1("操作失败")
                    $(".loading").fadeOut();
                    $(".yunBei").css("display","none")
                    return
                }
                btn_alert("操作成功");
                window.location.href='/Recheck/index'
            },'json');
        }
    });
</script>
<include file="Public/foot" />